package com.tedu.boot04.controller;

import com.tedu.boot04.entity.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(String name){
        return "服务器收到了请求"+name;
    }
    //当客户端发出的是post请求并且提交的参数时js对象的情况下需要添加@RequestBody注解 否则收到是null
    @RequestMapping("/postAxios")
    public String postAxios(@RequestBody User user){
        return "post请求成功"+user.toString();
    }
}
